<template>
  <div id="login">
    <van-nav-bar
      title="注册页面"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="container">
      <van-form validate-first @submit="onSubmit">
        <van-field
          v-model="username"
          name="name"
          label="用户名"
          placeholder="用户名"
          :rules="[
            { pattern: usernamePattern, message: '请输入正确内容' },
            { required: true, message: '请填写用户名' }
          ]"
        />
        <van-field
          v-model="password"
          type="password"
          name="password"
          label="密码"
          placeholder="密码"
          :rules="[
            { pattern: passwordPattern, message: '请输入正确内容' },
            { required: true, message: '请填写密码' }
          ]"
        />
        <van-field name="uploader" label="文件上传">
          <template #input>
            <van-uploader v-model="uploader" @change="gitFile" />
          </template>
        </van-field>
        <div class="subLoginBtn">
          <van-button round block type="info" native-type="submit"
            >提交注册</van-button
          >
        </div>
      </van-form>
      <div class="otherOperating">
        <span @click="goLogin">已有账号返回登录</span>
      </div>
    </div>
  </div>
</template>

<script src="./registry.js"></script>
<style scoped lang="less">
@import url('./login.less');
@import url('./registry.less');
</style>
